#pragma once

#include "RendererTypes.hpp"
#include "Task.hpp"

#include <boost/ptr_container/ptr_list.hpp>

namespace cge {
	class Engine;

	class Renderer: public Task {
	public:
		Renderer( Engine &e );
		virtual ~Renderer() {}

		Engine& getEngine() { return e_; }

		void   runTask();

		void   addVisible   ( Visible*    visible );
		void   addCuller    ( Culler*     culler );

		void   toggleOcclusionCulling( bool occlusionCulling );

		void   clearRenderers();

	private:
		typedef boost::ptr_list<Renderer> RendererList;
		typedef boost::ptr_list<Culler>   CullerList;
		friend class Visible;

		void   removeVisible_( Visible *vis );
		
		Engine&               e_;
		std::auto_ptr<Octree> visTree_;
		CullerList            culls_;
	};
}